<link rel="stylesheet" type="text/css" href="../style/style.css" />
<script language="javascript" src="../js/event.js"></script>
<script language="javascript" src="../js/calendar.js"></script>
<script type="text/javascript">	
	MaskInput = function(f, m){
	function mask(e){
		var patterns = {"1": /[A-Z]/i, "2": /[0-9]/, "4": /[\xC0-\xFF]/i, "8": /./ },
			rules = { "a": 3, "A": 7, "9": 2, "C":5, "c": 1, "*": 8};
		function accept(c, rule){
			for(var i = 1, r = rules[rule] || 0; i <= r; i<<=1)
				if(r & i && patterns[i].test(c))
					break;
				return i <= r || c == rule;
		}
		var k, mC, r, c = String.fromCharCode(k = e.key), l = f.value.length;
		(!k || k == 8 ? 1 : (r = /^(.)\^(.*)$/.exec(m)) && (r[0] = r[2].indexOf(c) + 1) + 1 ?
			r[1] == "O" ? r[0] : r[1] == "E" ? !r[0] : accept(c, r[1]) || r[0]
			: (l = (f.value += m.substr(l, (r = /[A|9|C|\*]/i.exec(m.substr(l))) ?
			r.index : l)).length) < m.length && accept(c, m.charAt(l))) || e.preventDefault();
	}
	for(var i in !/^(.)\^(.*)$/.test(m) && (f.maxLength = m.length), {keypress: 0, keyup: 1})
		addEvent(f, i, mask);
};

	function Validate(){
		if(document.forms[0].tunda_cuti.value == ""){
			alert("Tanggal ambil tunda cuti harus diisi ...");
			document.forms[0].tunda_cuti.focus();
			return false;
		}
		
		document.forms[0].submit();
	}
</script>
<?
	if($HTTP_POST_VARS['tutup'] == "yes"){
		include("../lib/config.php");
		mssql_query("WITH limit AS (SELECT * FROM CutiTahunan WHERE NIK='".$HTTP_POST_VARS['nik']."') UPDATE limit SET aktif='T', ambil='1', keterangan='diambil tgl ".$HTTP_POST_VARS['tunda_cuti']." (".$HTTP_POST_VARS['keterangan'].")' WHERE id='".$HTTP_POST_VARS['no']."'",$conn);
?>
<script type="text/javascript">
			opener.location.reload();
			close();
</script>
<?	
	}
?>
<form action="<?=$PHP_SELF?>" method="post">
<table align="center">
 <tr>
  <td>Masukkan tanggal untuk pengambilan cuti tunda:</td>
 </tr>
 <tr>
  <td><input type="text" maxlength="10" name="tunda_cuti"> <span class="required">*</span><i> <a href="javascript:calA.popup();"><img src="../../images/cal.gif" width="16" height="16" border="0" alt="Kalendar" title="Kalendar"> <input type="hidden" name="tutup" value="yes"><input type="hidden" name="nik" value="<?=$HTTP_GET_VARS['nik']?>"><input type="hidden" name="no" value="<?=$HTTP_GET_VARS['no']?>"></td>
 </tr>
 <tr>
  <td>Keterangan:<br />
  <input type="text" name="keterangan" /><input type="button" value="Simpan" name="tombol" class="button" onClick="Javascript:Validate();"><input type="button" value="Batal" onClick="Javascript:window.close();" class="button"></td>
 </tr>
</table>
</form>
<script type="text/javascript">
var f = document.forms[0];
MaskInput(f.tunda_cuti,"99/99/9999");
//MaskInput(f.ipk,"999");
//]]>
</script>
<script type="text/javascript">
// script untuk popup calendar
	var calA = new calendar1(document.forms[0].elements['tunda_cuti']);
	calA.year_scroll = true;
	calA.time_comp = false;	
</script>
